import time

from  day11_7_30.Base.Base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    # 1.定位器
    home_login_loc=(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')


    #2.页面元素封装
    def home_login(self):
        self.click(self.home_login_loc)
    user_username_loc = (By.NAME, 'username')
    def user_username(self):
        self.send_keys(self.user_username_loc,'19064013675')

    user_password_loc = (By.NAME, 'password')
    def user_password(self):
        self.send_keys(self.user_password_loc,'123456')
    button_loc = (By.XPATH,'//*[@id="theForm"]/div[5]/a')
    def button(self):
        self.click(self.button_loc)
    yq1_loc=(By.XPATH,'/html/body/div[4]/div/div[1]/div[1]/span[1]')
    def yq1(self):
        return self.text(self.yq1_loc)

    yq2_loc=(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def yq2(self):
        return self.text(self.yq2_loc)

    yq21_loc=(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[4]/span')
    def yq21(self):
        return self.text(self.yq21_loc).replace('¥ ','')


    # 业务逻辑
    def A3mall_log_01(self):
        self.open_url('http://10.59.9.12:7001/')
        self.home_login()
        print(self.yq1())
        self.user_username()
        self.user_password()
        time.sleep(10)
        self.button()
        time.sleep(5)
        print(self.yq2())
        print(self.yq21())

